<!DOCTYPE html>
<html>
<head>
	<base href="<?php echo XXF_HTTP?>" />
    <meta charset="utf-8">
    <title>模拟练习系统</title>
<style type="text/css">
*{margin:0px;padding:0px;-moz-box-sizing: border-box;  /*Firefox3.5+*/-webkit-box-sizing: border-box; /*Safari3.2+*/-o-box-sizing: border-box; /*Opera9.6*/-ms-box-sizing: border-box; /*IE8*/box-sizing: border-box;}
.bigger{width:25px;height:25px;}
.hidden{display:none;}
</style>
</head>
<body>
<div style="width: 800px;margin:0 auto;background-color:#eee;padding:15px;font-size:x-large;">
<div style="text-align: center;font-weight:900;">模拟练习</div><br><br>
<?php 
$i=1;
foreach ($panduan as $row){
?>
[<?php echo $row['tixing']?>] <?php echo $i++?>、<?php echo $row['timian']?>
<br><br>
<div style="text-align: right;" id='p_<?php echo $row['id'];?>'><span class="hidden" style="color:#eee;">[参考答案：<?php echo $row['biaozhundaan']?>]</span>
<input type="radio" name="p_<?php echo $row['id']?>" value="√" class="bigger">√ 
<input type="radio" name="p_<?php echo $row['id']?>" value="×" class="bigger">× 
</div>
<hr style="margin-top:5px;margin-bottom:5px ;">
<?php 
}
foreach ($danxuan as $row){
    ?>
[<?php echo $row['tixing']?>] <?php echo $i++?>、<?php echo $row['timian']?>
<br><br>
<?php 
$str=preg_replace('/A/','A ',$row["xuanxiang"],1);
$str=preg_replace('/B/','<br>B ',$str,1);
$str=preg_replace('/C/','<br>C ',$str,1);
echo $str;
?>
<div style="text-align: right;" id='p_<?php echo $row['id'];?>'><span  class="hidden" style="color:#eee;">[参考答案：<?php echo $row['biaozhundaan']?>]</span>
<input type="radio" name="p_<?php echo $row['id']?>" value="A"  class="bigger">A 
<input type="radio" name="p_<?php echo $row['id']?>" value="B"  class="bigger">B 
<input type="radio" name="p_<?php echo $row['id']?>" value="C"  class="bigger">C 
</div>
<hr style="margin-top:5px;margin-bottom:5px ;">
<?php 
}foreach ($duoxuan as $row){
?>
[<?php echo $row['tixing']?>] <?php echo $i++?>、<?php echo $row['timian']?>
<br><br>
<?php 
$str=preg_replace('/A/','A ',$row["xuanxiang"],1);
$str=preg_replace('/B/','<br>B ',$str,1);
$str=preg_replace('/C/','<br>C ',$str,1);
$str=preg_replace('/D/','<br>D ',$str,1);
$str=preg_replace('/E/','<br>E ',$str,1);
echo $str;
?>
<div style="text-align: right;" id='d_<?php echo $row['id'];?>'><span  class="hidden" style="color:#eee;">[参考答案：<?php echo $row['biaozhundaan']?>]</span>
<input type="checkbox" name="d_<?php echo $row['id']?>" value="A" class="bigger">A 
<input type="checkbox" name="d_<?php echo $row['id']?>" value="B" class="bigger">B 
<input type="checkbox" name="d_<?php echo $row['id']?>" value="C" class="bigger">C 
<input type="checkbox" name="d_<?php echo $row['id']?>" value="D" class="bigger">D 
<?php if(strpos($row["xuanxiang"],"E")!==false){?>
<input type="checkbox" name="d_<?php echo $row['id']?>" value="E" class="bigger">E 
<?php }?>
</div>
<hr style="margin-top:5px;margin-bottom:5px ;">
<?php 
}
?>
<div style="text-align: center;"><button onclick="jiaojuan()" style="width: 100px;height:50px;font-size:25px;">交 卷</button>
<button onclick="redati()" style="width: 200px;height:50px;font-size:25px;">练习下一套题</button>
</div>
</body>
</html>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="js/jquery.xxfset.js?r=<?php echo rand()?>"></script>
<script>
var daan={
    <?php
    foreach ($panduan as $row){
        echo "p_".$row['id'].":'".$row['biaozhundaan']."',";
    }
    foreach ($danxuan as $row){
        echo "p_".$row['id'].":'".$row['biaozhundaan']."',";
    }
    foreach ($duoxuan as $row){
        echo "d_".$row['id'].":'".$row['biaozhundaan']."',";
    }
    ?>
};
var pid=[
    <?php
    foreach ($panduan as $row){
        echo "'p_".$row['id']."',";
    }
    foreach ($danxuan as $row){
        echo "'p_".$row['id']."',";
    }
    ?>
];
var did=[
<?php
    foreach ($duoxuan as $row){
        echo "'d_".$row['id']."',";
    }
    ?>
];
function jiaojuan(){
	var fenshu=0;
	for(e of pid){
		if($("input[name='"+e+"']:checked").val()==daan[e]){
			fenshu++;
		}else{
			document.getElementById(e).style.backgroundColor='red';
		}
	}
	for(e of did){
		var str="";
		$("input[name='"+e+"']:checked").each(function(){
			str+=this.value;
		});
		if(str==daan[e]){
			fenshu++;
		}else{
			document.getElementById(e).style.backgroundColor='red';
		}
	}
	$.xalert("<font color=red size=7>得分："+fenshu+"，做错的题目已标红，请自行查看！</font>",function(){
		$(".hidden").removeClass("hidden");
	});
}
function redati(){
	$.xconfirm("是否确定练习下一套题？",function(data){
		if(data)
		location.href="pxexam/type/practicelogin";
	});
}
</script>